package br.com.management.mentor.view.events.handlers;

import org.springframework.beans.factory.annotation.Autowired;

import br.com.management.mentor.view.core.View;
import br.com.management.mentor.view.core.ViewManager;
import br.com.management.mentor.view.events.Event;
import br.com.management.mentor.view.events.LoggedEvent;

public class OnUserLoginEventHandler implements ViewEventHandler {

	@Autowired
	private ViewManager manager;

	private View home;

	@Override
	public boolean canHandle( Event event ) {
		return event.getClass().equals( LoggedEvent.class );
	}

	@Override
	public void handle( View view , Event event ) {
		manager.buildMenus();
		manager.goToView( getHome() );
	}

	public View getHome() {
		return home;
	}

	public void setHome( View home ) {
		this.home = home;
	}

}